<?php
/**
 * Created by PhpStorm.
 * User: XUANH
 * Date: 5/24/14
 * Time: 1:57 PM
 */
add_theme_support( 'post-thumbnails' );

if (class_exists('MultiPostThumbnails')) {
    new MultiPostThumbnails(
        array(
            'label' => 'Secondary Image',
            'id' => 'secondary-image',
            'post_type' => 'post'
        )
    );
}

if (function_exists('register_sidebar')) {
    register_sidebar(array(
        'name' => 'Search Widgets',
        'id'   => 'search-widgets',
        'description'   => 'These are widgets for search page.',
        'before_widget' => '',
        'after_widget'  => '',
    ));
}

if (function_exists('register_sidebar')) {
    register_sidebar(array(
        'name' => 'ContactUs Widgets',
        'id'   => 'contactus-widgets',
        'description'   => 'These are widgets for contact form.',
        'before_widget' => '',
        'after_widget'  => '',
    ));
}

function html5_search_form( $form ) {
    $form = '<section class="search"><form role="search" method="get" id="search-form" action="' . home_url( '/' ) . '" >
    <label class="screen-reader-text" for="s">' . __('',  'domain') . '</label>
     <input type="text" value="' . get_search_query() . '" name="keywords" id="keywords" placeholder="Nhập từ khóa" />
     </form></section>';
    return $form;
}

add_filter( 'get_search_form', 'html5_search_form' );

if (!function_exists('write_log')) {

    function write_log ( $log )  {

        if ( true === WP_DEBUG ) {

            if ( is_array( $log ) || is_object( $log ) ) {

                error_log( print_r( $log, true ) );

            } else {

                error_log( $log );

            }

        }

    }
}





